<legend>Nueva Promesa</legend>
<?php if (isset($this->error)) : ?>
    <?php if ($this->error) : ?>
        <div class="alert alert-error alert-block">
            <button type="button" class="close" data-dismiss="alert">×</button>
            <?php echo $this->mensaje ?>
        </div>
    <?php else : ?>
        <div class="alert alert-success alert-block">
            <button type="button" class="close" data-dismiss="alert">×</button>
            <?php echo $this->mensaje ?>
        </div>
    <?php endif; ?>
<?php endif; ?>

<form name="reserva_form" method="POST" action="<?php echo $this->baseUrl("/usuarios/ajax/guardarpromesa/") ?>"  >
    <input type="hidden" name="cliente_id" value="<?php echo $this->cliente_id ?>" />
    <style>
        td { padding-left: 10px;padding-right: 10px; }
    </style>
    <table class="table">
        <tr>
            <td style="width:180px;">
                <label>Fecha Promesa</label>
                <div class="input-append">
                    <input id="fecha_promesa" name="fecha_promesa" value="" class="input-small" type="text" />
                    <span class="add-on"><i class="icon-calendar"></i></span>
                </div>
            </td>
            <td style="width:180px;">
                <label>Dias de Promesa</label>
                <div class="input-append">
                    <input id="dias_de_promesa" name="dias_de_promesa" class="input-mini" type="text" value="30" />
                    <span class="add-on"><i class="icon-resize-horizontal"></i></span>
                </div>
                <input type="checkbox" name="fecha_verif_laboral" value="1"> Fecha Verif. Laboral<br>
            </td>
            <td>
                <label>Credito</label>
                <select id="credito_id" name="credito_id">
                    <?php if (count($this->creditos)) { ?>
                        <?php foreach ($this->creditos as $credito) { ?>
                        <option value="<?php echo $credito->getId() ?>">Credito Nro. <?php echo " ".$credito->getNumero() ?></option>
                        <?php } ?>
                    <?php } ?>
                </select>
            </td>
            <td></td>
        </tr>
        <tr>
            <td colspan="4">
                <label>Comentarios</label>
                <div class="controls">
                    <textarea id="comentario" name="comentario" style="width:100%;" rows="4"></textarea>
                </div>
            </td> 
        </tr>
        <tr>
            <td>
                <div class="btn-toolbar">
                    <input value="Guardar" class="btn btn-primary pull-right" type="submit" />
                </div>
            </td>
        </tr>
    </table>
</form>

<script type="text/javascript">
    $(function() {
        $("#fecha_promesa").datepicker({dateFormat: 'dd/mm/yy'});
        <?php if (isset($this->error)) { ?>
            <?php if (!$this->error) { ?>
                    <?php echo $this->script ?>
            <?php } ?>
        <?php } ?>
    });
</script>